home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00023_Dynamite Class.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  3.1 KB  |  116 lines

  1. property holesFilled, dynoBitmap, dynoFlag, holeList, firstHoleChan, dynoAnimChan, sandboxChan
  2. global gCustomCursor, gRollAnimButton, gLevelObject, gTruckObject, gSimObject
  3.  
  4. on birth me
  5.   set dynoBitmap to the number of cast "dynamite"
  6.   set holesFilled to 0
  7.   set holeList to [0, 0]
  8.   set firstHoleChan to 1
  9.   set dynoAnimChan to 12
  10.   set sandboxChan to 27
  11.   return me
  12. end
  13.  
  14. on setup me
  15.   add(gActorList, birth(script "Rollover Anim Button Class", "goMenu( gDynamiteObject, me )", 27, 27, 5, "RCA-07VO01", "RCA-07RO01"))
  16.   add(gActorList, birth(script "Rollover Anim Button Class", "help( gDynamiteObject, me )", 28, 28, 11, EMPTY, "RCA-05RO02"))
  17.   puppetSprite(dynoAnimChan, 1)
  18. end
  19.  
  20. on boxClick me
  21.   if not objectp(gCustomCursor) and (holesFilled < 2) then
  22.     showAllActors()
  23.     hideAllActors()
  24.     birth(script "ColorCursor Class", dynoBitmap)
  25.     add(gActorList, gCustomCursor)
  26.   end if
  27. end
  28.  
  29. on plungerClick me
  30.   if holesFilled = 2 then
  31.     puppetSprite(dynoAnimChan, 0)
  32.     go("RocksDone")
  33.   end if
  34. end
  35.  
  36. on activeAreaClick me
  37.   if sprite 48 within the clickOn and objectp(gCustomCursor) then
  38.     set whichHole to the clickOn - firstHoleChan + 1
  39.     if getAt(holeList, whichHole) = 0 then
  40.       setAt(holeList, whichHole, 1)
  41.       showAllActors()
  42.       set holesFilled to holesFilled + 1
  43.       set the locH of sprite dynoAnimChan to the locH of sprite 48
  44.       set the locV of sprite dynoAnimChan to the locV of sprite 48
  45.       set the castNum of sprite dynoAnimChan to the castNum of sprite 48
  46.       dispose(gCustomCursor)
  47.       updateStage()
  48.       animateSprite(dynoAnimChan, point(the locH of sprite the clickOn, the locV of sprite dynoAnimChan), 1)
  49.       animateSprite(dynoAnimChan, point(the locH of sprite the clickOn, 440), 1)
  50.       if holesFilled = 2 then
  51.         unLoadCast()
  52.         preLoad(label("RocksDone"), label("LastRock"))
  53.       end if
  54.     end if
  55.   end if
  56. end
  57.  
  58. on frameDelay me
  59.   startTimer()
  60.   repeat while the timer < 60
  61.   end repeat
  62. end
  63.  
  64. on globalButtonClick me
  65.   if objectp(gCustomCursor) then
  66.     showAllActors()
  67.     dispose(gCustomCursor)
  68.   else
  69.     if objectp(gRollAnimButton) then
  70.       click(gRollAnimButton)
  71.     end if
  72.   end if
  73. end
  74.  
  75. on finishedGame me
  76.   frameDelay(me)
  77.   set the tileNum of the blockedCellObj of gTruckObject to 0
  78.   set the tileType of the blockedCellObj of gTruckObject to #BG
  79.   set x to blockCrossings(the cell of gTruckObject, getLast(the recordedMoveList of gSimObject))
  80.   reset(me)
  81.   clearAllActors()
  82.   keepSandboxBut(sandboxChan)
  83.   puppetPalette("DynoPal")
  84.   go("Grass")
  85.   go(the frame + 1)
  86.   puppetSprite(48, 0)
  87.   puppetPalette("SimPal", 60)
  88.   updateStage()
  89.   puppetPalette(0)
  90.   predrawSimButtons(gSimObject)
  91.   go(label("Simulator" & string(the level of gLevelObject)))
  92. end
  93.  
  94. on reset me
  95.   set holesFilled to 0
  96.   set holeList to [0, 0]
  97. end
  98.  
  99. on goMenu me, buttonObject
  100.   forgetObstacle(gSimObject)
  101.   reset(me)
  102.   clearAllActors()
  103.   unpuppetAll()
  104.   makeButtonJump(buttonObject)
  105.   puppetSprite(48, 0)
  106.   puppetPalette("DynoPal")
  107.   go("Grass")
  108.   go(the frame + 1)
  109.   unLoadCast()
  110.   goLocationMap()
  111. end
  112.  
  113. on help me, buttonObject
  114.   birth(script "Help Parent", buttonObject, #Dynamite)
  115. end
  116.